package com.jd.jobkeeper.server.transport;

import com.jd.jobkeeper.protocals.Request;
import com.jd.jobkeeper.protocals.SubscribeResponse;
import reactor.core.publisher.Mono;

import java.util.Collection;

public interface JobServerTransport {

    Collection<String> getAllNamespace();

    NodeContext selectNode(String namespace);

    NodeContext selectNode(String namespace,String nodeId);

    NodeContext selectNode(String namespace,int index);

    Mono<SubscribeResponse> subscribe(Request request, ServerTransport transport);

    /**
     * Close the transport for namespace
     * @param namespace
     */
    void closeTransport(String namespace);
}
